<!DOCTYPE HTML>
<html>
<head>
<script src="../resources/pointer-lock/pointer-lock-test-harness.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
  promise_test(() => {
    return new Promise((resolve, reject) => {
      window.addEventListener('message', (event) => {
        if (event.data == "inner-iframe.html onpointerlockerror") {
          resolve();
        } else if (event.data != 'inner frame load') {
          reject(event.data);
        }
      });
      window.addEventListener('message', (event) => {
        if (event.data == 'inner frame load') {
          clickOnElement(iframe);
        }
      });
      var iframe = document.createElement('iframe');
      iframe.sandbox = 'allow-scripts';
      iframe.src = '../resources/pointer-lock/iframe-allows-inner-iframe.html';
      document.body.appendChild(iframe);
    });
  }, 'Test sandboxed nested iframe without allow-pointer-lock does not allow pointer lock.');
</script>
</body>
</html>
